package com.atguigu;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class GiaoAdvice5 {

    @Around("com.atguigu.MyPointCut.mympc()")
    public Object before(ProceedingJoinPoint joinPoint) {
        try {
            //相当于前置增强
            System.out.println("前置增强");
            Object[] args = joinPoint.getArgs();
            Object proceed = joinPoint.proceed(args);
            //相当于后置返回增强
            System.out.println("相当于后置返回增强");
            return proceed;
        } catch (Throwable e) {
            System.out.println("相当于异常返回增强");
            throw new RuntimeException(e);
        }finally {
            System.out.println("相当于后置增强");
        }



    }


}
